#ifndef GateHandler_h__
#define GateHandler_h__

#include "Common.h"

#include "JME_TcpSession.h"
#include "JME_NetHandler.h"
#include "JME_Dispatcher.h"
#include "JME_Message.h"
#include "JME_RpcClient.h"
#include "JME_RpcServer.h"

USING_NAMESPACE_JMENGINE;
USING_NAMESPACE_JMENGINE_NET;
USING_NAMESPACE_JMENGINE_GAME;
USING_NAMESPACE_JMENGINE_RPC;

typedef JME_Dispatcher<JME_Message::JME_MessagePtr> MessageDispatcher;
#define Dispatcher boost::detail::thread::singleton<MessageDispatcher>::instance()

class GateNetHandler : 
	public JME_NetHandler
{
public:
	void sessionConnectSucceed(JME_TcpSessionPtr session);
	void sessionConnectFailed(JME_TcpSessionPtr session, boost::system::error_code e);
	void sessionDisconnect(JME_TcpSessionPtr session, boost::system::error_code e);
	void sessionReceiveMessage(JME_TcpSessionPtr session, JME_Message::JME_MessagePtr msg);
	void sessionReadError(JME_TcpSessionPtr session, boost::system::error_code e);
};
#endif // GateHandler_h__
